﻿
namespace NetROS.Tiers.Windows.Forms
{
	/// <summary>
	/// abstract Blagajna typed datagridview
	/// </summary>
	[System.ComponentModel.DesignerCategoryAttribute("code")]
	public abstract class BlagajnaDataGridViewBase : System.Windows.Forms.UserControl
	{	
		/// <summary> 
		/// Thrown when the current Entity changed.
		/// </summary>
		public event System.EventHandler<BlagajnaDataGridViewEventArgs> CurrentEntityChanged;
		
		#region Fields
				
		/// <summary> 
		/// the current entity.
		/// </summary>
		private Entities.Blagajna _currentBlagajna = null;
		//private Dictionary<string, string> _columnsHeaders = new Dictionary<string, string>();
		
		/// <summary> 
		/// the datagridview instance
		/// </summary>
		protected System.Windows.Forms.DataGridView uxBlagajnaDataGridView;
		
		/// <summary> 
		/// the errorprovider
		/// </summary>
		protected System.Windows.Forms.ErrorProvider uxBlagajnaErrorProvider;
		
		/// <summary> 
		/// the bindingsource
		/// </summary>
		protected System.Windows.Forms.BindingSource uxBlagajnaBindingSource;
		
		
		/// <summary> 
		/// the DGV column associated with the ID property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxIDDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the Naziv property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxNazivDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the PocetnoStanje property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxPocetnoStanjeDataGridViewColumn;
		/// <summary> 
		/// the DGV column associated with the IDOrganizacija property
		/// </summary>
		protected System.Windows.Forms.DataGridViewComboBoxColumn uxIDOrganizacijaDataGridViewColumn;
		/// <summary> 
		/// the DGV column associated with the IDKonto property
		/// </summary>
		protected System.Windows.Forms.DataGridViewComboBoxColumn uxIDKontoDataGridViewColumn;
		/// <summary> 
		/// the DGV column associated with the IDVrstaFinDokumenta property
		/// </summary>
		protected System.Windows.Forms.DataGridViewComboBoxColumn uxIDVrstaFinDokumentaDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the PocetniBrojUplatnice property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxPocetniBrojUplatniceDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the PocetniBrojIsplatnice property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxPocetniBrojIsplatniceDataGridViewColumn;
		
		#endregion
					
		#region Combo list
		
				
		private Entities.TList<Entities.Konto> _IDKontoList;
		
		/// <summary> 
		/// The list of selectable Konto
		/// </summary>
		[System.ComponentModel.Category("DropDownList BindingSources")]
		public Entities.TList<Entities.Konto> IDKontoList
		{
			get {return this._IDKontoList;}
			set 
			{
				this._IDKontoList = value;
				this.uxIDKontoDataGridViewColumn.DataSource = null;
				this.uxIDKontoDataGridViewColumn.DataSource = this._IDKontoList;
			}
		}
		
		private bool _allowNewItemInIDKontoList;
		
		/// <summary> 
		/// Indicates if user can add an item in the list of Konto
		/// </summary>
		[System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Indicates if end user can add a new item in the combobox. an event will be thrown then.")]
		public bool AllowNewItemInIDKontoList
		{
			get { return _allowNewItemInIDKontoList;}
			set
			{
				this._allowNewItemInIDKontoList = value;
				this.uxIDKontoDataGridViewColumn.DisplayStyle = value ? System.Windows.Forms.DataGridViewComboBoxDisplayStyle.ComboBox : System.Windows.Forms.DataGridViewComboBoxDisplayStyle.DropDownButton;
			}
		}
		
				
		private Entities.TList<Entities.Organizacija> _IDOrganizacijaList;
		
		/// <summary> 
		/// The list of selectable Organizacija
		/// </summary>
		[System.ComponentModel.Category("DropDownList BindingSources")]
		public Entities.TList<Entities.Organizacija> IDOrganizacijaList
		{
			get {return this._IDOrganizacijaList;}
			set 
			{
				this._IDOrganizacijaList = value;
				this.uxIDOrganizacijaDataGridViewColumn.DataSource = null;
				this.uxIDOrganizacijaDataGridViewColumn.DataSource = this._IDOrganizacijaList;
			}
		}
		
		private bool _allowNewItemInIDOrganizacijaList;
		
		/// <summary> 
		/// Indicates if user can add an item in the list of Organizacija
		/// </summary>
		[System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Indicates if end user can add a new item in the combobox. an event will be thrown then.")]
		public bool AllowNewItemInIDOrganizacijaList
		{
			get { return _allowNewItemInIDOrganizacijaList;}
			set
			{
				this._allowNewItemInIDOrganizacijaList = value;
				this.uxIDOrganizacijaDataGridViewColumn.DisplayStyle = value ? System.Windows.Forms.DataGridViewComboBoxDisplayStyle.ComboBox : System.Windows.Forms.DataGridViewComboBoxDisplayStyle.DropDownButton;
			}
		}
		
				
		private Entities.TList<Entities.VrstaFinDokumenta> _IDVrstaFinDokumentaList;
		
		/// <summary> 
		/// The list of selectable VrstaFinDokumenta
		/// </summary>
		[System.ComponentModel.Category("DropDownList BindingSources")]
		public Entities.TList<Entities.VrstaFinDokumenta> IDVrstaFinDokumentaList
		{
			get {return this._IDVrstaFinDokumentaList;}
			set 
			{
				this._IDVrstaFinDokumentaList = value;
				this.uxIDVrstaFinDokumentaDataGridViewColumn.DataSource = null;
				this.uxIDVrstaFinDokumentaDataGridViewColumn.DataSource = this._IDVrstaFinDokumentaList;
			}
		}
		
		private bool _allowNewItemInIDVrstaFinDokumentaList;
		
		/// <summary> 
		/// Indicates if user can add an item in the list of VrstaFinDokumenta
		/// </summary>
		[System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Indicates if end user can add a new item in the combobox. an event will be thrown then.")]
		public bool AllowNewItemInIDVrstaFinDokumentaList
		{
			get { return _allowNewItemInIDVrstaFinDokumentaList;}
			set
			{
				this._allowNewItemInIDVrstaFinDokumentaList = value;
				this.uxIDVrstaFinDokumentaDataGridViewColumn.DisplayStyle = value ? System.Windows.Forms.DataGridViewComboBoxDisplayStyle.ComboBox : System.Windows.Forms.DataGridViewComboBoxDisplayStyle.DropDownButton;
			}
		}
		
		#endregion
		
		#region Main Datasource
		
		private Entities.TList<Entities.Blagajna> _BlagajnaList;
				
		/// <summary> 
		/// The list of Blagajna to be displayed in the DGV.
		/// </summary>
		[System.ComponentModel.Category("Data")]
		public Entities.TList<Entities.Blagajna> BlagajnaList
		{
			get {return this._BlagajnaList;}
			set
			{
				this._BlagajnaList = value;
				this.uxBlagajnaBindingSource.DataSource = null;
				this.uxBlagajnaBindingSource.DataSource = value;
				this.uxBlagajnaDataGridView.DataSource = null;
				this.uxBlagajnaDataGridView.DataSource = this.uxBlagajnaBindingSource;				
				//this.uxBlagajnaBindingSource.ListChanged += new System.ComponentModel.ListChangedEventHandler(uxBlagajnaBindingSource_ListChanged);
				this.uxBlagajnaBindingSource.CurrentItemChanged += new System.EventHandler(OnBlagajnaBindingSourceCurrentItemChanged);
			}
		}
		
		private void OnBlagajnaBindingSourceCurrentItemChanged(object sender, System.EventArgs e)
		{
			_currentBlagajna = uxBlagajnaBindingSource.Current as Entities.Blagajna;
			
			if (_currentBlagajna != null)
			{
				_currentBlagajna.Validate();
			}
			//_Blagajna.Validate();
			OnCurrentEntityChanged();
		}

		//void uxBlagajnaBindingSource_ListChanged(object sender, System.ComponentModel.ListChangedEventArgs e)
		//{
			//throw new Exception("The method or operation is not implemented.");
		//}		
		
		#endregion
		
		/// <summary>
		/// Gets the currently selected <c cref="Entities.Blagajna"/> instance.
		/// </summary>
		public Entities.Blagajna SelectedBlagajna
		{
			get {return this._currentBlagajna;}
		}
		
		#region other properties
		
		/// <summary>
		/// Gets or sets a value indicating whether you have provided your own data-management operations for the DataGridView control.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]
		public bool VirtualMode
		{
			get {return this.uxBlagajnaDataGridView.VirtualMode;}
			set
			{
				this.uxBlagajnaDataGridView.VirtualMode = value;
			}
		}
		
		/// <summary>
		/// Gets or sets a value indicating whether the option to add rows is displayed to the user.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]
		public bool AllowUserToAddRows
		{
			get {return this.uxBlagajnaDataGridView.AllowUserToAddRows;}
			set {this.uxBlagajnaDataGridView.AllowUserToAddRows = value;}
		}
		
		/// <summary>
		/// Gets or sets a value indicating whether the user is allowed to delete rows from the DataGridView.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]
		public bool AllowUserToDeleteRows
		{
			get {return this.uxBlagajnaDataGridView.AllowUserToDeleteRows;}
			set {this.uxBlagajnaDataGridView.AllowUserToDeleteRows = value;}
		}
		
		/// <summary>
		/// Gets the <c cref="DataGridView"/> instance.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]
		public System.Windows.Forms.DataGridView DataGridView
		{
			get {return this.uxBlagajnaDataGridView;}
		}
		
		/// <summary>
		/// Gets a collection that contains all the columns in the control.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]		
		[System.ComponentModel.DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Visible)]
		//[System.ComponentModel.EditorAttribute("System.Windows.Forms.Design.DataGridViewColumnCollectionEditor, System.Design", typeof(System.Drawing.Design.UITypeEditor))] 
		public System.Windows.Forms.DataGridViewColumnCollection Columns
		{
			get { return this.uxBlagajnaDataGridView.Columns; }
		}
		
		#endregion
		
		/// <summary> 
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.IContainer components = null;
	
		/// <summary> 
		/// Clean up any resources being used.
		/// </summary>
		/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
		protected override void Dispose(bool disposing)
		{
			if (disposing && (components != null))
			{
				components.Dispose();
			}
			base.Dispose(disposing);
		}
	
		#region Constructor
	
		/// <summary>
		/// Initializes a new instance of the <see cref="BlagajnaDataGridViewBase"/> class.
		/// </summary>
		public BlagajnaDataGridViewBase()
		{			
			this.components = new System.ComponentModel.Container();			
			
			this.uxBlagajnaDataGridView = new System.Windows.Forms.DataGridView();
			this.uxBlagajnaBindingSource = new System.Windows.Forms.BindingSource(this.components);
			this.uxBlagajnaErrorProvider = new System.Windows.Forms.ErrorProvider(this.components);
			this.uxIDDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxNazivDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxPocetnoStanjeDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxIDOrganizacijaDataGridViewColumn = new System.Windows.Forms.DataGridViewComboBoxColumn();
			this.uxIDKontoDataGridViewColumn = new System.Windows.Forms.DataGridViewComboBoxColumn();
			this.uxIDVrstaFinDokumentaDataGridViewColumn = new System.Windows.Forms.DataGridViewComboBoxColumn();
			this.uxPocetniBrojUplatniceDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxPocetniBrojIsplatniceDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			//this.uxIDKontoBindingSource = new KontoBindingSource(this.components);
			//((System.ComponentModel.ISupportInitialize)(this.uxIDKontoBindingSource)).BeginInit();
			//this.uxIDOrganizacijaBindingSource = new OrganizacijaBindingSource(this.components);
			//((System.ComponentModel.ISupportInitialize)(this.uxIDOrganizacijaBindingSource)).BeginInit();
			//this.uxIDVrstaFinDokumentaBindingSource = new VrstaFinDokumentaBindingSource(this.components);
			//((System.ComponentModel.ISupportInitialize)(this.uxIDVrstaFinDokumentaBindingSource)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.uxBlagajnaDataGridView)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.uxBlagajnaBindingSource)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.uxBlagajnaErrorProvider)).BeginInit();
			this.SuspendLayout();
						
			// 
			// uxBlagajnaErrorProvider
			// 
			this.uxBlagajnaErrorProvider.ContainerControl = this;
			this.uxBlagajnaErrorProvider.DataSource = this.uxBlagajnaBindingSource;						
			// 
			// uxBlagajnaDataGridView
			// 
			this.uxBlagajnaDataGridView.AutoGenerateColumns = false;
			this.uxBlagajnaDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
			this.uxBlagajnaDataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
		this.uxIDDataGridViewColumn,
		this.uxNazivDataGridViewColumn,
		this.uxPocetnoStanjeDataGridViewColumn,
		this.uxIDOrganizacijaDataGridViewColumn,
		this.uxIDKontoDataGridViewColumn,
		this.uxIDVrstaFinDokumentaDataGridViewColumn,
		this.uxPocetniBrojUplatniceDataGridViewColumn,
		this.uxPocetniBrojIsplatniceDataGridViewColumn			});
			this.uxBlagajnaDataGridView.Dock = System.Windows.Forms.DockStyle.Fill;
			this.uxBlagajnaDataGridView.Location = new System.Drawing.Point(0, 0);
			this.uxBlagajnaDataGridView.Name = "uxBlagajnaDataGridView";
			this.uxBlagajnaDataGridView.Size = new System.Drawing.Size(470, 300);
			this.uxBlagajnaDataGridView.TabIndex = 0;	
			this.uxBlagajnaDataGridView.BackgroundColor = System.Drawing.Color.WhiteSmoke;
			this.uxBlagajnaDataGridView.EnableHeadersVisualStyles = false;
			this.uxBlagajnaDataGridView.DataError += new System.Windows.Forms.DataGridViewDataErrorEventHandler(this.OnBlagajnaDataGridViewDataError);
			this.uxBlagajnaDataGridView.CellValueNeeded += new System.Windows.Forms.DataGridViewCellValueEventHandler(this.OnBlagajnaDataGridViewCellValueNeeded);
			this.uxBlagajnaDataGridView.CellValuePushed += new System.Windows.Forms.DataGridViewCellValueEventHandler(this.OnBlagajnaDataGridViewCellValuePushed);
			
			//
			// uxIDDataGridViewColumn
			//
			this.uxIDDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxIDDataGridViewColumn.DataPropertyName = "ID";
			this.uxIDDataGridViewColumn.HeaderText = "ID";
			this.uxIDDataGridViewColumn.Name = "uxIDDataGridViewColumn";
			this.uxIDDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxIDDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxIDDataGridViewColumn.ReadOnly = true;		
			//
			// uxNazivDataGridViewColumn
			//
			this.uxNazivDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxNazivDataGridViewColumn.DataPropertyName = "Naziv";
			this.uxNazivDataGridViewColumn.HeaderText = "Naziv";
			this.uxNazivDataGridViewColumn.Name = "uxNazivDataGridViewColumn";
			this.uxNazivDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxNazivDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxNazivDataGridViewColumn.ReadOnly = false;		
			//
			// uxPocetnoStanjeDataGridViewColumn
			//
			this.uxPocetnoStanjeDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxPocetnoStanjeDataGridViewColumn.DataPropertyName = "PocetnoStanje";
			this.uxPocetnoStanjeDataGridViewColumn.HeaderText = "PocetnoStanje";
			this.uxPocetnoStanjeDataGridViewColumn.Name = "uxPocetnoStanjeDataGridViewColumn";
			this.uxPocetnoStanjeDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxPocetnoStanjeDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxPocetnoStanjeDataGridViewColumn.ReadOnly = false;		
			//
			// uxIDOrganizacijaDataGridViewColumn
			//
			this.uxIDOrganizacijaDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxIDOrganizacijaDataGridViewColumn.DataPropertyName = "IDOrganizacija";
			this.uxIDOrganizacijaDataGridViewColumn.HeaderText = "IDOrganizacija";
			this.uxIDOrganizacijaDataGridViewColumn.Name = "uxIDOrganizacijaDataGridViewColumn";
			this.uxIDOrganizacijaDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxIDOrganizacijaDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxIDOrganizacijaDataGridViewColumn.ReadOnly = false;		
			//
			// uxIDKontoDataGridViewColumn
			//
			this.uxIDKontoDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxIDKontoDataGridViewColumn.DataPropertyName = "IDKonto";
			this.uxIDKontoDataGridViewColumn.HeaderText = "IDKonto";
			this.uxIDKontoDataGridViewColumn.Name = "uxIDKontoDataGridViewColumn";
			this.uxIDKontoDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxIDKontoDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxIDKontoDataGridViewColumn.ReadOnly = false;		
			//
			// uxIDVrstaFinDokumentaDataGridViewColumn
			//
			this.uxIDVrstaFinDokumentaDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxIDVrstaFinDokumentaDataGridViewColumn.DataPropertyName = "IDVrstaFinDokumenta";
			this.uxIDVrstaFinDokumentaDataGridViewColumn.HeaderText = "IDVrstaFinDokumenta";
			this.uxIDVrstaFinDokumentaDataGridViewColumn.Name = "uxIDVrstaFinDokumentaDataGridViewColumn";
			this.uxIDVrstaFinDokumentaDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxIDVrstaFinDokumentaDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxIDVrstaFinDokumentaDataGridViewColumn.ReadOnly = false;		
			//
			// uxPocetniBrojUplatniceDataGridViewColumn
			//
			this.uxPocetniBrojUplatniceDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxPocetniBrojUplatniceDataGridViewColumn.DataPropertyName = "PocetniBrojUplatnice";
			this.uxPocetniBrojUplatniceDataGridViewColumn.HeaderText = "PocetniBrojUplatnice";
			this.uxPocetniBrojUplatniceDataGridViewColumn.Name = "uxPocetniBrojUplatniceDataGridViewColumn";
			this.uxPocetniBrojUplatniceDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxPocetniBrojUplatniceDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxPocetniBrojUplatniceDataGridViewColumn.ReadOnly = false;		
			//
			// uxPocetniBrojIsplatniceDataGridViewColumn
			//
			this.uxPocetniBrojIsplatniceDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxPocetniBrojIsplatniceDataGridViewColumn.DataPropertyName = "PocetniBrojIsplatnice";
			this.uxPocetniBrojIsplatniceDataGridViewColumn.HeaderText = "PocetniBrojIsplatnice";
			this.uxPocetniBrojIsplatniceDataGridViewColumn.Name = "uxPocetniBrojIsplatniceDataGridViewColumn";
			this.uxPocetniBrojIsplatniceDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxPocetniBrojIsplatniceDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxPocetniBrojIsplatniceDataGridViewColumn.ReadOnly = false;		
			//
			// uxIDKontoDataGridViewColumn
			//				
			this.uxIDKontoDataGridViewColumn.DisplayMember = "Sifra";	
			this.uxIDKontoDataGridViewColumn.ValueMember = "ID";	
			this.uxIDKontoDataGridViewColumn.DisplayStyleForCurrentCellOnly = true;
			//uxIDKontoDataGridViewColumn.DataSource = uxIDKontoBindingSource;				
				
			//
			// uxIDOrganizacijaDataGridViewColumn
			//				
			this.uxIDOrganizacijaDataGridViewColumn.DisplayMember = "Naziv";	
			this.uxIDOrganizacijaDataGridViewColumn.ValueMember = "ID";	
			this.uxIDOrganizacijaDataGridViewColumn.DisplayStyleForCurrentCellOnly = true;
			//uxIDOrganizacijaDataGridViewColumn.DataSource = uxIDOrganizacijaBindingSource;				
				
			//
			// uxIDVrstaFinDokumentaDataGridViewColumn
			//				
			this.uxIDVrstaFinDokumentaDataGridViewColumn.DisplayMember = "Naziv";	
			this.uxIDVrstaFinDokumentaDataGridViewColumn.ValueMember = "ID";	
			this.uxIDVrstaFinDokumentaDataGridViewColumn.DisplayStyleForCurrentCellOnly = true;
			//uxIDVrstaFinDokumentaDataGridViewColumn.DataSource = uxIDVrstaFinDokumentaBindingSource;				
				
			
			// this
			this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
			this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
			this.Controls.Add(this.uxBlagajnaDataGridView);
			this.Name = "BlagajnaDataGridView";
			this.Size = new System.Drawing.Size(470, 300);
			//((System.ComponentModel.ISupportInitialize)(this.uxIDKontoBindingSource)).EndInit();
			//((System.ComponentModel.ISupportInitialize)(this.uxIDOrganizacijaBindingSource)).EndInit();
			//((System.ComponentModel.ISupportInitialize)(this.uxIDVrstaFinDokumentaBindingSource)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.uxBlagajnaErrorProvider)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.uxBlagajnaDataGridView)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.uxBlagajnaBindingSource)).EndInit();
			this.ResumeLayout(false);
		}
		#endregion
				
		#region events
		
		/// <summary>
		/// Raised the CurrentEntityChanged event.
		/// </summary>
		protected void OnCurrentEntityChanged()
		{
			if (CurrentEntityChanged != null)
			{
				BlagajnaDataGridViewEventArgs args = new BlagajnaDataGridViewEventArgs();
				args.Blagajna = _currentBlagajna;
				CurrentEntityChanged(this, args); 
			}
		}
		
		#endregion
		
		/// <summary>
		/// Strongly typed event 
		/// </summary>
		public class BlagajnaDataGridViewEventArgs : System.EventArgs
		{
			private Entities.Blagajna	_Blagajna;
	
			/// <summary>
			/// the  Entities.Blagajna instance.
			/// </summary>
			public Entities.Blagajna Blagajna
			{
				get { return _Blagajna; }
				set { _Blagajna = value; }
			}	
		}
		
		/// <summary>
		/// Handles the DataError event of the uxBlagajnaDataGridView control.
		/// </summary>
		/// <param name="sender">The source of the event.</param>
		/// <param name="e">The <see cref="T:System.Windows.Forms.DataGridViewDataErrorEventArgs"/> instance containing the event data.</param>
		protected void OnBlagajnaDataGridViewDataError(object sender, System.Windows.Forms.DataGridViewDataErrorEventArgs e)
		{
			System.Diagnostics.Debug.WriteLine(string.Format( "{0}, {1}", e.ColumnIndex, e.RowIndex));
		}
		
		/// <summary>
		/// Handles the CellValueNeeded event of the uxBlagajnaDataGridView control.
		/// </summary>
		/// <param name="sender">The source of the event.</param>
		/// <param name="e">The <see cref="T:System.Windows.Forms.DataGridViewCellValueEventArgs"/> instance containing the event data.</param>
		protected void OnBlagajnaDataGridViewCellValueNeeded(object sender, System.Windows.Forms.DataGridViewCellValueEventArgs e)
		{
			switch(uxBlagajnaDataGridView.Columns[e.ColumnIndex].Name)
			{
					case "uxIDDataGridViewColumn":
						e.Value = BlagajnaList[e.RowIndex].ID;
						break;
					case "uxNazivDataGridViewColumn":
						e.Value = BlagajnaList[e.RowIndex].Naziv;
						break;
					case "uxPocetnoStanjeDataGridViewColumn":
						e.Value = BlagajnaList[e.RowIndex].PocetnoStanje;
						break;
					case "uxIDOrganizacijaDataGridViewColumn":
						e.Value = BlagajnaList[e.RowIndex].IDOrganizacija;
						break;
					case "uxIDKontoDataGridViewColumn":
						e.Value = BlagajnaList[e.RowIndex].IDKonto;
						break;
					case "uxIDVrstaFinDokumentaDataGridViewColumn":
						e.Value = BlagajnaList[e.RowIndex].IDVrstaFinDokumenta;
						break;
					case "uxPocetniBrojUplatniceDataGridViewColumn":
						e.Value = BlagajnaList[e.RowIndex].PocetniBrojUplatnice;
						break;
					case "uxPocetniBrojIsplatniceDataGridViewColumn":
						e.Value = BlagajnaList[e.RowIndex].PocetniBrojIsplatnice;
						break;
				default:
				break;
			}
		}
		
		/// <summary>
		/// Handles the CellValuePushed event of the uxBlagajnaDataGridView control.
		/// </summary>
		/// <param name="sender">The source of the event.</param>
		/// <param name="e">The <see cref="T:System.Windows.Forms.DataGridViewCellValueEventArgs"/> instance containing the event data.</param>
		protected void OnBlagajnaDataGridViewCellValuePushed(object sender, System.Windows.Forms.DataGridViewCellValueEventArgs e)
		{
			switch(uxBlagajnaDataGridView.Columns[e.ColumnIndex].Name)
			{
					case "uxIDDataGridViewColumn":
						BlagajnaList[e.RowIndex].ID = (System.Int32)e.Value;
						break;
					case "uxNazivDataGridViewColumn":
						BlagajnaList[e.RowIndex].Naziv = (System.String)e.Value;
						break;
					case "uxPocetnoStanjeDataGridViewColumn":
						BlagajnaList[e.RowIndex].PocetnoStanje = (System.Decimal)e.Value;
						break;
					case "uxIDOrganizacijaDataGridViewColumn":
						BlagajnaList[e.RowIndex].IDOrganizacija = (System.Int32)e.Value;
						break;
					case "uxIDKontoDataGridViewColumn":
						BlagajnaList[e.RowIndex].IDKonto = (System.Int32)e.Value;
						break;
					case "uxIDVrstaFinDokumentaDataGridViewColumn":
						BlagajnaList[e.RowIndex].IDVrstaFinDokumenta = (System.Int32)e.Value;
						break;
					case "uxPocetniBrojUplatniceDataGridViewColumn":
						BlagajnaList[e.RowIndex].PocetniBrojUplatnice = (System.Int32)e.Value;
						break;
					case "uxPocetniBrojIsplatniceDataGridViewColumn":
						BlagajnaList[e.RowIndex].PocetniBrojIsplatnice = (System.Int32)e.Value;
						break;
				default:
				break;
			}
		}
	}
}
